package jc16;

public class jincheng {
    public static void main(String[] args) {
        shoupiao s = new shoupiao();
        shoupiao s1 = new shoupiao();
        shoupiao s2 = new shoupiao();
        shoupiao s3 = new shoupiao();
        s.start();
        s1.start();
        s2.start();
        s3.start();
    }
}
class shoupiao extends Thread{
    static int q = 1;
    Object o = new Object();
    @Override
    public void run() {
        while (true){
            synchronized (o){
                if (q<0){
                    try {
                        shoupiao.sleep(12);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
                System.out.println(shoupiao.currentThread().getName()+"="+q++);
                if (q>100)break;
            }
        }
    }
}